=============== Explanation ===============
'Explanation 1' – Run the code from A to G in the folder to generate Figure 3 in the paper.

'Explanation 2' – Before running the code, make sure to place the 'map.tif', 'landfrag_abundances_jun2024_final_version_2.csv', 'landfrag_studies_jun2024_metrics_final_version_2.csv', 'sigma_all.csv' (You can also use the recalculated sigma.) and 'immigration.csv' files from the 'Data' folder into the current working directory.

=============== Code ===============
'A_Select_patches.m' – This code is designed to select patches.

'B_Calculate_site_diversity.R' – This code is designed to calculate diversity.

'C_Create_metacommunity.m' – This code is designed to create metacommunities.

'D_Create_localcommunity.m' – This code is designed to create local communities.

'E_Calculate_site_diversity_simulation.R' – This code is designed to calculate diversity.

'F_Draw_box_plot.R' – This code is used to generate box plots for diversity and slope.

'G_Plot_Figure3.m' – This code is designed to plot Figure 3.

